package com.mygo.designPattern.behavioral.chainOfResponsibilityPattern;

// 组长审批者
class TeamLeader extends Approver {
    @Override
    public void processRequest(LeaveRequest request) {
        if (request.getLeaveDays() <= 3) {
            System.out.println("组长批准了 " + request.getEmployeeName() + " 的 " + request.getLeaveDays() + " 天请假申请。");
        } else if (nextApprover != null) {
            nextApprover.processRequest(request);
        }
    }
}

// 经理审批者
class Manager extends Approver {
    @Override
    public void processRequest(LeaveRequest request) {
        if (request.getLeaveDays() <= 7) {
            System.out.println("经理批准了 " + request.getEmployeeName() + " 的 " + request.getLeaveDays() + " 天请假申请。");
        } else if (nextApprover != null) {
            nextApprover.processRequest(request);
        }
    }
}

// 总监审批者
class Director extends Approver {
    @Override
    public void processRequest(LeaveRequest request) {
        if (request.getLeaveDays() <= 15) {
            System.out.println("总监批准了 " + request.getEmployeeName() + " 的 " + request.getLeaveDays() + " 天请假申请。");
        } else {
            System.out.println("总监拒绝了 " + request.getEmployeeName() + " 的 " + request.getLeaveDays() + " 天请假申请，请假天数过多。");
        }
    }
}